import request from '@/utils/request'

/**
 * 分页查询操作日志
 */
export function getLogList(data) {
  return request({
    url: '/admin/logs/list',
    method: 'post',
    data
  })
}

/**
 * 获取日志统计信息
 */
export function getLogStats(params) {
  return request({
    url: '/admin/logs/stats',
    method: 'get',
    params
  })
}

/**
 * 清理过期日志
 */
export function cleanExpiredLogs(days) {
  return request({
    url: '/admin/logs/clean',
    method: 'delete',
    params: { days }
  })
}

/**
 * 导出日志
 */
export function exportLogs(params) {
  return request({
    url: '/admin/logs/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

/**
 * 获取日志详情
 */
export function getLogDetail(id) {
  return request({
    url: `/admin/logs/${id}`,
    method: 'get'
  })
}

/**
 * 批量删除日志
 */
export function batchDeleteLogs(ids) {
  return request({
    url: '/admin/logs/batch',
    method: 'delete',
    data: ids
  })
}
